//
//  ViewController.m
//  UI02_homework01
//
//  Created by aaaaaa on 16/6/6.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ViewController.h"
#import "CustumUILable.h"
#import "CustumUITextField.h"
@interface ViewController ()<UITextFieldDelegate>

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self createUILable];
    [self creatUITextField];
    [self createUIButton];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (void)createUILable{
    
    CustumUILable *userNameLable = [CustumUILable custumUILableWithFrame:CGRectMake(50 + 32, 50, 80, 30) withText:@"用户名"];
    [self.view addSubview:userNameLable];
    
    CustumUILable *passWordLable = [CustumUILable custumUILableWithFrame:CGRectMake(50 + 32, 120, 80, 30) withText:@"密码"];
    [self.view addSubview:passWordLable];
    
    
    CustumUILable *rePassWordLable = [CustumUILable custumUILableWithFrame:CGRectMake(50 + 32, 190, 80, 30) withText:@"确认密码"];
    [self.view addSubview:rePassWordLable];
    
    CustumUILable *phoneLable = [CustumUILable custumUILableWithFrame:CGRectMake(50 + 32, 260, 80, 30) withText:@"手机号"];
    [self.view addSubview:phoneLable];
    
    CustumUILable *emailLable =[CustumUILable custumUILableWithFrame:CGRectMake(50 + 32, 330, 80, 30) withText:@"邮箱"];
    [self.view addSubview:emailLable];
    
    
}


- (void)creatUITextField{
    
    CustumUITextField *userNameTextField = [CustumUITextField customUITextFieldWithFrame:CGRectMake(150 + 32, 50, 150, 30) withPlaceholder:@"请输入用户名"];
    [self.view addSubview:userNameTextField];
    userNameTextField.delegate = self;
    
    CustumUITextField *passWordTextField = [CustumUITextField customUITextFieldWithFrame:CGRectMake(150 + 32, 120, 150, 30) withPlaceholder:@"请输入密码"];
    passWordTextField.secureTextEntry = YES;
    [self.view addSubview:passWordTextField];
    passWordTextField.delegate = self;
    
    CustumUITextField *rePassWordTextField = [CustumUITextField customUITextFieldWithFrame:CGRectMake(150 + 32, 190, 150, 30) withPlaceholder:@"再次输入密码"];
    rePassWordTextField.secureTextEntry = YES;
    [self.view addSubview:rePassWordTextField];
    rePassWordTextField.delegate = self;
    
    CustumUITextField *phoneTextField = [CustumUITextField customUITextFieldWithFrame:CGRectMake(150 + 32, 260, 150, 30) withPlaceholder:@"请输入联系方式"];
    phoneTextField.keyboardType = UIKeyboardTypeNumberPad;
    [self.view addSubview:phoneTextField];
    phoneTextField.delegate = self;
    
    CustumUITextField *emailTextField = [CustumUITextField customUITextFieldWithFrame:CGRectMake(150 + 32, 330, 150, 30) withPlaceholder:@"请输入邮箱"];
    [self.view addSubview:emailTextField];
    emailTextField.delegate = self;

    
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField{
    [textField resignFirstResponder];
    return YES;
}

- (void)createUIButton{
    
    UIButton *loginButton = [UIButton buttonWithType:UIButtonTypeSystem];
    loginButton.frame = CGRectMake(50 + 32 + 50, 400, 50, 30);
    [loginButton setTitle:@"注册" forState:UIControlStateNormal];
    [loginButton setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
    [self.view addSubview:loginButton];

    
    UIButton *cancelButton = [UIButton buttonWithType:UIButtonTypeSystem];
    cancelButton.frame = CGRectMake(190 + 32, 400, 50, 30);
    [cancelButton setTitle:@"取消" forState:UIControlStateNormal];
    [cancelButton setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
    [self.view addSubview:cancelButton];
}




@end
